#include "queue.h"
#include <iostream>

using namespace queued;

void Queue::QueueEnqueue(int data)
{
    this->m_data.ListInsert(new doublelist::ListElmt(data));
}

int Queue::QueueDequeue(int &data)
{
    doublelist::ListElmt* ret = this->m_data.ListHead();
    if (ret == NULL)
    {
        return -1;
    }

    data = ret->GetData();
    this->m_data.ListDel(ret);
    delete ret;

    return 0;
}

int Queue::QueueHead(int &data)
{
    doublelist::ListElmt* ret = this->m_data.ListHead();
    if (ret == NULL)
    {
        return -1;
    }

    data = ret->GetData();
    return 0;
}

int Queue::QueueSize()
{
    return this->m_data.GetListSize();
}
